import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const state = {
  webName: '',
  novelData: '',
  name: "",
  dialogWidth: '',
  labelWidth: '',
  paginationLayout: '',
  elColNum: '',
  dialogMaxWidth: '',
  setLabelWidth: '',
  windowWidth: document.documentElement.clientWidth,  //实时屏幕宽度
  MaxWidth:'750',
};

const getters = {
  getWebName() {
    return state.webName
  },
  getNovelData() {
    return state.novelData
  },
  getCoinName() {
    return state.name
  },
  getDialogWidth() {
    return state.dialogWidth
  },
  getLabelWidth() {
    return state.labelWidth
  },
  getPaginationLayout() {
    return state.paginationLayout
  },
  getElColNum() {
    return state.elColNum
  },
  getDialogMaxWidth() {
    return state.dialogMaxWidth
  },
  getSetLabelWidth() {
    return state.setLabelWidth
  }
};

const mutations = {
  newName(state, sum) {
    state.webName = sum
  },
  newNovel(state, sum) {
    state.novelData = sum;
  },
  newCoinName(state, sum) {
    state.name = sum;
  },
  newDialogWidth(state, sum) {
    state.dialogWidth = sum;
  },
  newLabelWidth(state, sum) {
    state.labelWidth = sum;
  },
  newPaginationLayout(state, sum) {
    state.paginationLayout = sum;
  },
  newElColNum(state, sum) {
    state.elColNum = sum
  },
  newDialogMaxWidth(state, sum) {
    state.dialogMaxWidth = sum
  },
  newSetLabelWidth(state, sum) {
    state.setLabelWidth = sum
  }
};

const actions = {
  getNewName(context, num) {
    context.commit('newName', num)
  },
  getNewNovel(context, num) {
    context.commit('newNovel', num)
  },
  getNewCoinName(context, num) {
    context.commit('newCoinName', num)
  },
  getNewDialogWidth(context, num) {
    context.commit('newDialogWidth', num)
  },
  getNewLabelWidth(context, num) {
    context.commit('newLabelWidth', num)
  },
  getNewPaginationLayout(context, num) {
    context.commit('newPaginationLayout', num)
  },
  getNewElColNum(context, num) {
    context.commit('newElColNum', num)
  },
  getNewDialogMaxWidth(context, num) {
    context.commit('newDialogMaxWidth', num)
  },
  getNewSetLabelWidth(context, num) {
    context.commit('newSetLabelWidth', num)
  }
};


const store = new Vuex.Store({
  state,
  getters,
  mutations,
  actions
});
export default store;